<template>

    <div class='statu1 dd-column'>
        <MyOrderDetailsContent :detailsData="detailsData" :goodsTAndList="goodsTAndList" />
        <div class='item dd-row dd-h-center topay'>
            <div class='dd-btn-yellow-c' @click='topay(detailsData)'>立即支付</div>
        </div>
        <div @click='cancelPay' class='dd-text-center cancelPay'>
            取消订单
        </div>
    </div>

</template>
<script>
import MyOrderDetailsContent from "@/components/My/myOrderDetails/MyOrderDetailsContent.vue";
import { mapMutations } from "vuex";
export default {
  props: ["detailsData", "goodsTAndList"],
  components: {
    MyOrderDetailsContent
  },
  methods: {
    // ...mapState(state => {
    //   orderWaitPay: state => {
    //       return state.goods.orderWaitPay
    //   };
    // }),

    // topay 待支付的点击直接去支付
    topay(detailsData) {
      console.log("去付款");
      console.log(detailsData);

      this.$store.commit("makeOrderWaitPay", detailsData);

      this.$router.push("/pay");
    },

    // cancelPay 取消订单
    cancelPay() {
      let that = this;

      // 获取一下本地缓存的 待支付订单
      let tempArr1 = wx.getStorageSync("waitPayOrderStorageData");
      console.log("tempArr1--->", tempArr1);
      // 查看时间戳
      let timeStamp = that.data.detailsData.timeStamp;
      // 删除对应的订单的缓存
      let tArr = dd.dd.deleteByXX(tempArr1, timeStamp, "timeStamp");
      // 删除之后 再存缓存
      wx.setStorageSync("waitPayOrderStorageData", tArr);
      //返回上一层
      wx.navigateBack(-1);
    }
  }
};
</script>
<style scoped>
.topay {
  margin-top: 20pt;
}

.cancelPay {
  margin: 10pt;
  font-size: 10pt;
}
</style>
